/**
 * @author: zouye<yzyngz@foxmail.com>
 * @date: 2021-09-26 21:09:36
 * @copyright: zouye<yzyngz@foxmail.com>
 */
package com.yeah.spring.springbootstudy.common;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

/**
 * 用于获取 request 和 response
 */
public class ServletHolder {

	private static ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
	
	public static HttpServletRequest getServletRequest() {
		return attributes.getRequest();
	}
	
	public static HttpServletResponse getServletResponse() {
		return attributes.getResponse();
	}
}
